import './assets/main.css'

import { createApp } from 'vue'
import App from './App.vue'
import GlobalCom from './components/GlobalCom.vue'
import router from './router/index.js'
import store from './store'

// 引入 axios, vueAxios
import axios from 'axios'
import VueAxios from 'vue-axios'

axios.interceptors.request.use((config) =>{
    console.log('config',config);
    config.headers.test = 'test11111'
    return config
}, function (error) {
    console.log(error);
})

axios.interceptors.response.use((response) =>{
    console.log('response',response);
    if (response.status === 200) {
        return response.data
    } else {
        // ...
    }
})


const app = createApp(App)

// 注册全局组件
app.component(GlobalCom.name, GlobalCom)

// 注册路由
app.use(router)

// 挂载Vuex
app.use(store)

// 注册 axios, VueAxios
app.use(VueAxios, axios)


app.mount('#app')
